#version 450

out gl_PerVertex
{
    vec4 gl_Position;
};

vec3 vertices[] =
{
    vec3(0.f, 0.f, 0.f),
    vec3(0.f, 0.5f, 0.f),
    vec3(-0.5f, 0.f, 0.f),
};

vec4 colors[] =
{
    vec4(1.f, 0.f, 0.f, 1.f),
    vec4(0.f, 1.f, 0.f, 1.f),
    vec4(0.f, 0.f, 1.f, 1.f),
};

out layout(location = 0) vec4 vertexColor;

void main()
{
    vec3 pos = vertices[gl_VertexIndex];
    gl_Position = vec4(pos.x, -pos.y, pos.z, 1.f);
    vertexColor = colors[gl_VertexIndex];
}